<template>
  <div>
    <Bread></Bread>
    <input type="text">
    <Table :columns="columns1" :data="studentlist"></Table>
    <Button type="success" @click="loadUserList">加载</Button>
    <button @click="close">关闭</button>
  </div>
</template>

<script>
import { Bread } from "@/components";
export default {
  components: { Bread },
  data() {
    return {
      columns1: [
        {
          title: "编号",
          key: "id"
        },
        {
          title: "性别",
          key: "sex",
          render: (h, params) => {
            return h("div", params.row.sex === 1 ? "男" : "女");
          }
        },
        {
          title: "姓名",
          key: "name"
        },
        {
          title: "年龄",
          key: "age"
        },
        {
          title: "地址",
          key: "address"
        }
      ],
      studentlist: []
    };
  },
  mounted() {
    
  },
  methods: {
    close() {
      this.$destroy(); //手动销毁
      this.$router.push("/bbb");
    },
    loadUserList() {
      this.$service.user.getClassList().then(res => {
        this.studentlist = res.data;
      });
    }
  }
};
</script>

<style>
</style>
